<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    li{
      list-style-type: none;
      width:500px;
      margin-top:10px;
      height: 30px;
      background-color: skyblue;
    }
  </style>
</head>
<body>
  <div id="app">
   <ul>
     <li 
      v-for="(item,index) in arr" 
      @click="change(index)"
      :key="index">
       {{ item }}
     </li>
   </ul>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el:"#app",
      data:{
        arr:[5,5,5,5,5]
      },
      methods:{
        change(index){
          this.arr[index] = 0;
          console.log(this.arr)
          // this.$set(this.arr,index,0)
          Vue.set(this.arr,index,0)
        }
      }
    })
    // Object.defineProperty 无法追踪到 数组[下标] = 值
    // 数组[下标].xxx = 值  set  Vue.set  this.$set(对象,'属性',值)
  </script>
</body>
</html>
